/*using UnityEngine;
using System.Collections;

public class BSP_Node
{
	public int root;
	public int currentNode = null;
	public int[] rectangle;
	public int[] children;
	public int sister;
	public int parent;
	public Stack rooms = new Stack();
	public int currentRect;
	public int i=0;
	public int splitDirection=0;
	
	private int x;
	private int y;
	private int height;
	private int width;
	int getRandomInt(int min, int max)
	{
		int rnd = Random.Range(min,max);
		return rnd;
	}
	void createChildren(int currentNode)
	{
		/*if(currentRoom.parent == null)
		{
			root.x = 0;
			root.y = 0;
			root.width = Screen.width;
			root.height = Screen.height;
			currentRoom = root;
			addRoom(currentRoom);
			parent.children[i] = currentRoom;
			currentRoom.sister = children[i++];
			i++;
			parent.children[i];
			this.sister = children[i--];
			i++;
		}
		else
		{
			currentRoom.children[i];
			addRoom(children[i]);
			this.sister = children[i++];
			i++;
			currentRoom.children[i];
			addRoom(children[i]);
			this.sister = children[i--];
			i++;
		
		}/////////////////////////////////////////////////////////////////  
		if(this.currentNode = null)
		{
			this.currentNode = addRoom(currentNode);
		}
		if(this.parent = null)
		{
			root.x = 0;
			root.y = 0;
			root.width = Screen.width;
			root.height = Screen.height;
			currentRoom = root;
			addRoom(currentNode);
			this.sister = null;
		}
		this.rooms.Push(currentNode);
	}
	void addRoom(int currentNode)
	{
		if(this.parent)
		{
			this.parent = addRoom(currentNode);
		}
		this.rooms.Push(currentNode);
		this.createChildren(currentNode);
	}
}

public class Rectangle
{
	public int x;
	public int y;
	public int width;
	public int height;
	public int bottom = y+height;
	public int right = x+width;
	
	public void rectangle(int x,int y,int w,int h)
	{
		this.x = x;
		this.y = y;
		this.width = w;
		this.height = h;
		this.bottom = y+h;
		this.right = x+w;
	}
	
	void updateRect()
	{
		this.right = this.x + this.width;
		this.bottom = this.y + this.height;
	}
	Rectangle copyRect()
	{
		return new Rectangle(this.x,this.y,this.width,this.height);
	}
	int intersects(Rectangle other)
	{
		int left = Mathf.Max(this.x,other.x);
		int right = Mathf.Min(this.right,other.right);
		int bottom = Mathf.Max(this.bottom,other.bottom);
		int top = Mathf.Min(this.y,other.y);
		return (right > left && bottom > top);
	}
	int contains(Rectangle other)
	{
		bool pointOne = false;
        bool pointTwo = false;
        bool pointThree = false;
        bool pointFour = false;
        
        if(other.x > this.x &&
           other.x < this.x + this.width &&
           other.y > this.y &&
           other.y < this.y + this.height) pointOne = true;
           
        if(other.x + other.width > this.x &&
           other.x + other.width < this.x + this.width &&
           other.y > this.y &&
           other.y < this.y + this.height) pointTwo = true;
           
                      
        if(other.x > this.x &&
           other.x < this.x + this.width &&
           other.y + other.height > this.y &&
           other.y + other.height < this.y + this.height) pointThree = true;  
                
           
        if(other.x + other.width > this.x &&
           other.x + other.width < this.x + this.width &&
           other.y + other.height > this.y &&
           other.y + other.height < this.y + this.height) pointFour = true;
           
           
        return pointOne && pointTwo && pointThree && pointFour;
	}
}

public class Parameters
{
	public int minSplit = 40;
	public int maxSplit = 60;
	public int minRoomSize = 45;
	public int maxRoomSize = 85;
	public int splitCount = 1;
	public int startSizeW = Screen.width;
	public int startSizeH = Screen.height;
}

public class BSP_Dungeon
{
	public int[] leafNodes;
	public int[] oldNodes;
	public int root = BSPtree2.root;
	public int parameters = Parameters;
	public bool displaySplits = true;*/
	/*public void clearRooms(int curNode);
	public void generateRooms();
	public void findSplit(int currentRoom);
	public void getLeafNodes(int data, int curNode);
	public void connectRooms();
	public void BSP_Split();
	public void BSP_DoSplits();
	*/
	/*void findSplit(int currentRoom)
	{
		int x = currentRoom.x;
		int y = currentRoom.y;
		int height = currentRoom.height;
		int width = currentRoom.width;
		
		splitDirection = getRandomInt(0,1);
		Console.write(splitDirection);
		//horizontal
		if(splitDirection ==0)
		{
			split = currentRoom.y+(getRandomInt(Parameters.minSplit,Parameters.maxSplit));
			new Rect(currentRoom.x,split,2,currentRoom.width);
		}
		//vertcal
		else if(splitDirection == 1)
		{
			split = currentroom.x+(getRandomInt(Parameters.minSplit,Parameters.maxSplit));
			new Rect(split,currentRoom.y,currentRoom.height,2);
		}
	}
}*/